<template>
  <div>
    <h2>添加部门</h2>
    部门名称<input type="text" v-model="name">
    <button @click="sub">添加</button>
  </div>
</template>

<script>
export default {
  data(){
    return{
      name:''
    }
  },
  methods:{
    sub:function(){

      let data={
        name:this.name,
        
      }
      this.axios({
        url:'http://127.0.0.1:8000/app01/depart/',
        method:'post',
        data:data
      }).then(res=>{
        if(res.data.code==1000){
          this.$router.push('/User')
        }else{
          alert(res.data.msg)
        }
      })
    }
  }
}
</script>

<style>

</style>
